// JavaScript Document
$(document).ready(function(){
	//返回顶部
	$("#back-top").bind('click', function(){
	$("html,body").animate({scrollTop:0},300); });
	
	//搜索框不能为空=============================================
	$('.submit_yundan').click(function(){
		var yundan = $("input[name='ydh']").val();
		if (yundan=="" || yundan=="请输入运单号进行查询"){
		   alert("请输入运单号码进行查询");$("input[name='ydh']").focus();return false;
		}else{
		   if(/[\u4e00-\u9fa5]/g.test(yundan)){ alert("运单号码不能包含汉字");$("#ydh").focus();return false; }
		}
	});
	$("input[name='ydh']").focus(function() {//获得焦点时清空
		if ($("input[name='ydh']").val()=="请输入运单号进行查询"){
			$("input[name='ydh']").val("").focus();
		}
	});
	$("input[name='ydh']").blur(function() {//失去焦点时赋值
		if ($("input[name='ydh']").val()==""){
			$("input[name='ydh']").val("请输入运单号进行查询");
		}
	});	
	//搜索框不能为空=============================================
	
	//上下页下拉菜单 选择页数跳转
	$("#jump-page").bind("change",function(){
	var page=$(this).val();
	var site_urls = window.location.href;
	site_urls = site_urls.replace(/(\&page=(\d+))/ig,'');//过滤掉page=N页
	if(site_urls != '') window.location.href = site_urls+ '&page='+page;
	});

});

//删除的直接跳转
function drop_confirm(msg, url){
    if(confirm(msg)){
        window.location = url;
    }
}

/*jQuery cookie 片断*/
jQuery.extend({getCookie:function(sName){var aCookie=document.cookie.split("; ");for(var i=0;i<aCookie.length;i++){var aCrumb=aCookie[i].split("=");if(sName==aCrumb[0])return decodeURIComponent(aCrumb[1]);}
return'';},setCookie:function(sName,sValue,sExpires,spath,sdomain,secure){var sCookie=sName+"="+encodeURIComponent(sValue);if(sExpires!=null)sCookie+="; expires="+sExpires;if(spath!=null)sCookie+="; path="+spath;if(sdomain!=null)sCookie+="; domain="+sdomain;if(secure!=null)sCookie+="; secure="+secure;document.cookie=sCookie;},removeCookie:function(sName){document.cookie=sName+"=; expires=Fri, 31 Dec 1999 23:59:59 GMT;";}});jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+options.path:'';var domain=options.domain?'; domain='+options.domain:'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};
